import request from '@/utils/request'
import { getToken as getCookieToken } from '@/utils/auth'

// 文件上传
export function upload(data) {
  return request({
    url: `/dfile/file/upload`,
    method: 'post',
    data: data
  })
}

// 文件下载
export function download(url) {
  return request({
    url: url,
    method: 'get',
    headers: {
      'Content-Type': 'application/octet-stream' // 流
    },
    responseType: 'blob',
    params: {
      access_token: getCookieToken()
    }
  })
}
